#include <QColorDialog>
#include "colorlabel.h"

using namespace PBVP;

ColorLabel::ColorLabel(QWidget *parent , const char* name /* =0 */) 
: QFrame( parent )
{
	setFrameStyle( QFrame::Panel|QFrame::Sunken );
	// setBackgroundMode( PaletteBackground );
	//setAcceptDrops( TRUE );
	//mousePressed = FALSE;
}

void ColorLabel::drawContents( QPainter *p )
{
    p->fillRect( contentsRect(), color );
}

void ColorLabel::mousePressEvent( QMouseEvent *e )
{
	QColor c;
	c = QColorDialog::getColor(color, this);
	if(c.isValid()) {
		color = c;
		setColor(color);
		emit colorChanged(color.rgb());
	}
}



